<?php $this->load->view('layout/header'); ?>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <h3 class="page-title">商品管理
                <small> 退款审核</small>
            </h3>
            <?php echo breadcrumb(array('商品管理', '商品订单', 'tourismorderrefund/grid' => '退款审核')); ?>
        </div>
    </div>
    <?php echo execute_alert_message() ?>
    <div class="row-fluid">
        <div class="span12">
            <div class="portlet box green">
                <div class="portlet-title">
                    <div class="caption"><i class="icon-search"></i>搜索</div>
                    <div class="tools">
                        <a class="collapse" href="javascript:;"></a>
                        <a class="remove" href="javascript:;"></a>
                    </div>
                </div>
                <div class="portlet-body form">
                    <form class="form-horizontal form-search" action="<?php echo base_url('tourismorderrefund/grid') ?>" method="get">
                        <div class="row-fluid">
                            <div class="span6">
                                <div class="control-group">
                                    <label class="control-label">订单ID</label>
                                    <div class="controls">
                                        <input type="text" name="order_id" value="<?php echo $this->input->get('order_id'); ?>" placeholder="请输入订单ID" class="m-wrap medium">
                                    </div>
                                </div>
                            </div>
                            <div class="span6">
                                <div class="control-group">
                                    <label class="control-label">商品搜索</label>
                                    <div class="controls">
                                        <input type="text" name="goods_name" value="<?php echo $this->input->get('goods_name'); ?>" placeholder="请输入产品名称或产品编号" class="m-wrap medium">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row-fluid">
                            <div class="span6">
                                <div class="control-group">
                                    <label class="control-label">供应商</label>
                                    <div class="controls">
                                        <input type="text" name="seller_name" value="<?php echo $this->input->get('seller_name'); ?>" placeholder="请输供应商账户名或别名" class="m-wrap medium">
                                    </div>
                                </div>
                            </div>
                            <div class="span6">
                                <div class="control-group">
                                    <label class="control-label">申请人</label>
                                    <div class="controls">
                                        <input type="text" name="user_name" value="<?php echo $this->input->get('user_name'); ?>" placeholder="请输入申请人或uid或手机号码" class="m-wrap medium">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row-fluid">
                            <div class="span6">
                                <div class="control-group">
                                    <label class="control-label">退款状态</label>
                                    <div class="controls">
                                        <select name="status" class="m-wrap medium">
                                            <option value="">请选择</option>
                                            <?php foreach ($refundStatus as $key => $value) : ?>
                                                <option value="<?php echo $key; ?>" <?php if ($key == $this->input->get('status')): ?> selected="selected"<?php endif; ?>><?php echo $value; ?></option>
                                            <?php endforeach; ?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="span6">
                                <div class="control-group">
                                    <label class="control-label">是否退款</label>
                                    <div class="controls">
                                        <select name="flag" class="m-wrap medium">
                                            <option value="">请选择</option>
                                            <?php foreach (array('1' => '未退款', '2' => '已退款') as $key => $value) : ?>
                                                <option value="<?php echo $key; ?>" <?php if ($key == $this->input->get('flag')): ?> selected="selected"<?php endif; ?>><?php echo $value; ?></option>
                                            <?php endforeach; ?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-actions">
                            <button class="btn green" type="submit">搜索</button>
                            <button class="btn reset_button_search" type="button">重置条件</button>
                        </div>
                    </form>
                </div>
            </div>
            <div class="portlet box green">
                <div class="portlet-title">
                    <div class="caption"><i class="icon-reorder"></i>列表</div>
                    <div class="tools">
                        <a class="collapse" href="javascript:;"></a>
                        <a class="remove" href="javascript:;"></a>
                    </div>
                </div>
                <div class="portlet-body flip-scroll">
                    <div class="dataTables_wrapper form-inline">
                        <div class="row-fluid scebery-order-pagination">
                            <span class="dataTables_info">
                                <span>当前第</span><span style="color: red"><?php echo $pg_now?></span>页 
                                <span>共</span><span style="color: red"><?php echo $all_rows?></span>条数据
                                <span>每页显示20条 </span>
                                <?php echo $pg_list ?>
                            </span>
                            <span class="scebery-order-find">
                               <input type="text" name="pg" value="<?php echo isset($pg_now) ? $pg_now :'';?>" class="m-wrap small" placeholder="请输入页数" />
                               <button type="button" class="btn green">确定</button>
                            </span>
                        </div>
                        <?php if ($all_rows > 0) : ?>
                            <table class="table table-striped table-bordered table-hover" id="sample_1">
                                <thead class="flip-content">
                                    <tr>
                                        <th width="15"><input type="checkbox" class="group-checkable" data-set="#sample_1 .checkboxes"></th>
                                        <th>编号</th>
                                        <th>商品订单</th>
                                        <th>商品名称</th>
                                        <th>退货数量</th>
                                        <th>供应商</th>
                                        <th>申请人</th>
                                        <th>手续费</th>
                                        <th>退款状态</th>
                                        <th>是否退款</th>
                                        <th>创建时间</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                <?php foreach ($page_list->result() as $item) : ?>
                                    <tr>
                                        <td width="30"><input type="checkbox" class="checkboxes" value="1"></td>
                                        <td><?php echo $item->refund_id; ?></td>
                                        <td>
                                            <p>订单ID：<?php echo $item->order_id; ?></p>
                                            <p>订单产品ID：<?php echo $item->order_product_id; ?></p>
                                            <p>产品ID：<?php echo $item->goods_attr_id; ?></p>
                                        </td>
                                        <td width="150"><?php echo $item->goods_name; ?></td>
                                        <td><?php echo $item->number; ?></td>
                                        <td>
                                            <p><?php echo $item->supplier_name; ?>（<?php echo $item->seller_uid; ?>）</p>
                                            <p><?php echo $item->alias_name; ?></p>
                                        </td>
                                        <td>
                                            <p><?php echo $item->user_name; ?>（<?php echo $item->uid; ?>）</p>
                                            <p><?php echo $item->cellphone; ?></p>
                                        </td>
                                        <td><?php echo $item->counter_fee; ?></td>
                                        <td><?php echo $refundStatus[$item->status]; ?></td>
                                        <td width="100">
                                            <p><?php echo $refundFlag[$item->flag]; ?></p>
                                            <?php if ($item->status==2 && $item->flag==1) :?>
                                                <a class="btn mini green" href="<?php echo base_url('tourismorderrefund/confirm/'.$item->refund_id.'/'.$pg_now) ?>" onclick="return confirm('退款金额将会退回购买者账户中，确定要退款？')"> 确认退款</a>
                                            <?php endif;?>
                                        </td>
                                        <td><?php echo $item->created_at; ?></td>
                                        <td><a class="btn mini green" href="<?php echo base_url('tourismorderrefund/info/'.$item->refund_id)?>">详情</a></td>
                                    </tr>
                                <?php endforeach; ?>
                                </tbody>
                            </table>
                            <div class="row-fluid">
                                <div class="dataTables_info">
                                    <span>当前第</span><span style="color: red"><?php echo $pg_now ?></span>页
                                    <span>共</span><span style="color: red"><?php echo $all_rows ?></span>条数据
                                    <span>每页显示20条 </span>
                                    <?php echo $pg_list ?>
                                </div>
                            </div>
                        <?php else: ?>
                            <div class="alert"><p>未找到数据。<p></div>
                        <?php endif ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
$('.scebery-order-find  button').click(function(){
	var pg = $(this).parents('.scebery-order-find').find('input[name="pg"]').val();
	if (pg.length==0) {
	    return false;
	}
	window.location.href="<?php echo base_url('tourismorderrefund/grid')?>"+"/"+pg+"<?php echo isset($url) ? $url :'';?>";
})
</script>
<?php $this->load->view('layout/footer'); ?>
